import requests
from lxml import etree

url="https://www.zbj.com/fw/?k=saas"

headers = {

    "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) "
                  "Chrome/119.0.0.0 Safari/537.36"
}


resp=requests.get(url, headers=headers)
resp.encoding="utf-8"
# print(resp.text)

et=etree.HTML(resp.text)

divs=et.xpath("//div[@class='search-result-list']")
for div in divs:
    # price=div.xpath("./div/div/div[4]/div[1]/span/text()")  # 不知道为什么输出为空
    prices = div.xpath("//div[@class='price']/span/text()")
    names=div.xpath("//div[@class='shop-info text-overflow-line']/text()")

    for price, name in zip(prices, names):
        print(price,name)


